<include file="common/header_lixin" title="首页" />
<style>
    .shop_flex{
        justify-content: space-between;
        padding: 0 0.2rem;
    }
    .weui-flex__item{
        flex: 0;
        width: 50%;
    }
</style>

<div class="page">

    <div class="page-bd">
        <!-- 页面内容-->
        <!-- 首页轮播图Swiper -->
        <div class="swiper-box">
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <adv pid ="513283" limit="5" item="v">
                        <div class="swiper-slide"> <a href="{$v.ad_link}"><img src="{$v[ad_code]}"/> </a></div>
                    </adv>
                </div>
                <!-- Add Pagination -->
                <div class="swiper-pagination"></div>
            </div>
        </div>
        <div class="index-box">
            <div class="card-flex">
                <a href="{:url('systemReport')}" class="flex_item border-none">
                    <div class="icon">
                        <img src="__PUBLIC__/assets/images/index_icon02.png" alt="">
                    </div>
                    <div class="fs24">系统公告</div>
                </a>
                <a href="{:url('share')}" class="flex_item border-none">
                    <div class="icon">
                        <img src="__PUBLIC__/assets/images/index_icon03.png" alt="">
                    </div>
                    <div class="fs24">推广二维码</div>
                </a>
                <a href="{:url('onlineService')}" class="flex_item border-none">
                    <div class="icon">
                        <img src="__PUBLIC__/assets/images/index_icon04.png" alt="">
                    </div>
                    <div class="fs24">联系客服</div>
                </a>
            </div>
        </div>

        <div class="weui-cells">
            <div class="weui-cell weui-cell_access">
                <div class="weui-cell__bd panel_tit fw600">
                    <p>矿机商城</p>
                </div>
            </div>
        </div>
        <div class="weui-flex shop_flex">
            <foreach name="miners" item="va">
                <div class="weui-flex__item">
                    <img src="{$va.original_img}" alt="">
                    <div class="tc mt10 mr30">
                        <div class="fs28">{$va.miner_name}</div>
                        <div class="fs22 text-gray2">产量/天：{$va.kj_speed}</div>
                        <div class="fs22 text-gray2">价格：{$va.miner_price}矿池钱包</div>
<!--                        <div onclick="activate({$va.miner_id})" class="buy_btn mt30">立即激活</div>-->
                        <div onclick="activate({$va.miner_id})" class="buy_btn mt30">立即激活</div>
                        <if condition="$va.miner_id neq 11">
                            <div onclick="upgrade({$va.miner_id})" class="buy_btn mt30">升级</div>
                        </if>

                    </div>
                </div>
            </foreach>
        </div>

    </div>
    <include file="common/footer_lixin"/>
</div>

<script src="__PUBLIC__/assets/js/Swiper-4.0.7/swiper.min.js"></script>
<script>
    $(function() {
        FastClick.attach(document.body);
    });

$.toast.prototype.defaults.duration = 1200;

    var ajax_status = false;
    function activate(id){
        window.location.href='/Acc/index/buy?id='+id;
    }

    /*var ajax_status = false;
    function activate(id){
        if (ajax_status) {return false;};
        ajax_status = true;
        $.ajax({
            url : "/index.php/Acc/Index/activate",
            type:'post',
            dataType:'json',
            data:{'id':id},
            success:function(data){
                if (data.code == 1) {
                    $.toast("激活成功", function() {
                        window.location.href='/Acc/Mining/my_mining';
                    });
                } else {
                    $.toast(data.msg, "forbidden");
                    ajax_status = false;
                }

            },
            error:function(){
                $.toptip('网络异常，请稍后再试', 'error');
            }
        })
    }
*/
    function upgrade(id){
        window.location.href='/Acc/Index/upgrade?id=' + id;
        /*$.ajax({
            url : "/index.php/Acc/Index/upgrade",
            type:'post',
            dataType:'json',
            data:{'id':id},
            success:function(data){
                if (data.code == 1) {
                    $.toast("升级成功", function() {
                        window.location.href='/Acc/Mining/my_mining';
                    });
                } else {
                    $.toast(data.msg, "forbidden");
                    ajax_status = false;
                }

            },
            error:function(){
                $.toptip('网络异常，请稍后再试', 'error');
            }
        })*/
    }

    $(function () {
        var status = "{$isReal}";
        if(status != 1){
            $.modal({
                title: "实名认证",
                text: "请立即完成实名认证，再进行后面的操作",
                buttons: [
                    { text: "立即认证", onClick: function(){ window.location="{:U('applyReal')}";} },
                    { text: "取消", className: "cancel", onClick: function(){return;} },
                ]
            });
        }
    });

    var swiper = new Swiper('.swiper-container', {
        pagination: {
            el: '.swiper-pagination',
        },
        autoplay:true,
    });
</script>
</body>
</html>
